#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;

//@file   : null
//@author : Chizuru
//@date   : 2024/4/1
//@brief  : null

size_t my_strlen(const char* str);
char* my_strcpy(char* dest, const char* src);
char* my_strncpy(char* dest, const char* src, size_t n);
char* my_strcat(char* dest, const char* src);
char* my_strncat(char* dest, const char* src, size_t n);
int my_strcmp(const char* str1, const char* str2);



size_t my_strlen(const char* str) {
    int idx = 0;
    while (str[idx]) {
        idx++;
    }
    return idx;
}


char* my_strcpy(char* dest, const char* src) {
    while (*dest++ = *src++);
    return dest;
}

char* my_strncpy(char* dest, const char* src, size_t n) {
    while (n-- && (*dest++ = *src++) );
    while(n){
        *dest = 0;
        n--;
    }
    return 0;
}


char* my_strcat(char* dest, const char* src) {
    while (*dest) {
        dest++;
    }
    while (*dest++ = *src++);
    return dest;
}


char* my_strncat(char* dest, const char* src, size_t n) {
    char* d = dest;
    while (*d) {
        d++;
    }
    while (n--) {
        *d++ = *src++;
    }
    *d = 0;
    return dest;
}
int my_strcmp(const char* str1, const char* str2) {
    while(!(*str1 - *str2)){
        str1++;
        str2++;
    }
    return (*str1 - *str2);
}



int main(void) {
    int a[10];






    return 0;

}
